#pragma once

// CMW2MP3Thread
#include <Thread/Thread.h>
#include "../WM2MP3Wnd.h"

class Job;

class CMW2MP3Thread : public CThread
{
public:
	DECLARE_DYNAMIC(CMW2MP3Thread)

	// Construction & Destruction
	CMW2MP3Thread(CWM2MP3Wnd* pWnd,Job* pJob);
	virtual ~CMW2MP3Thread();

	// Attributes
	CWM2MP3Wnd* m_pMainWnd;
	Job* m_pJob;
	// Operations & Overridables
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Abstract 'Draw Entity' method
	virtual void SingleStep();

protected:
	// Overridables
	/////////////////////////////////////////////////////////////////////////////////
	// Main Thread Handler
	// The only method that must be implemented
	virtual DWORD ThreadHandler();
	/////////////////////////////////////////////////////////////////////////////////
	virtual void OnInitThread();
	virtual void OnExitThread();

	// create a new process to convert wave to mp3
	DWORD MW2MP3_CreateProcess(LPTSTR inputWave, LPTSTR outputMp3);

	// check if any created processes has ended, call back if any
	BOOL MW2MP3_IsProcesseDone();
};
